//
//  AccountInfoViewController.m
//  AI
//
//  Created by zjhc on 2018/1/9.
//  Copyright © 2018年 zjhc. All rights reserved.
//  Descprition:个人中心控制器

#import "AccountInfoViewController.h"
#import "AvatarCell.h"
#import "UIImageView+WebCache.h"


@interface AccountInfoViewController ()<UITableViewDataSource,UITableViewDelegate> {
    NSString *imageStr;
}
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation AccountInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView reloadData];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 5;
}

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"commCell"];
    
     AvatarCell *avatarCell = [tableView dequeueReusableCellWithIdentifier:@"avatarCell"];
    
    switch (indexPath.row) {
        case 0:
        {

            avatarCell.title.text = @"头像";
            avatarCell.avatarImage.layer.masksToBounds = YES;
            avatarCell.avatarImage.layer.cornerRadius =avatarCell.avatarImage.frame.size.width/2;
            [avatarCell.avatarImage sd_setImageWithURL:[NSURL URLWithString:imageStr]  placeholderImage:[UIImage imageNamed:@"avatar" ] options:SDWebImageRefreshCached];
//            avatarCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            return avatarCell;
            break;
        }
        case 1:
            cell.textLabel.text = @"姓名";
            cell.detailTextLabel.text = @"黄晨露";
            cell.accessoryType=UITableViewCellAccessoryNone;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
            break;
        case 2:
            cell.textLabel.text = @"手机号";
            cell.detailTextLabel.text = @"18888885252";
            cell.accessoryType=UITableViewCellAccessoryNone;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
            break;
        case 3:
            cell.textLabel.text = @"所在营业厅";
            cell.detailTextLabel.text = @"南山路营业厅";
            cell.accessoryType=UITableViewCellAccessoryNone;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
            break;
        case 4:
            cell.textLabel.text = @"修改密码";
            cell.detailTextLabel.text = @"";

            return cell;
            break;
        default:
            break;
    }
    
    return  cell;
    
}

-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.row == 0 ) {
        return 80.0;
    }else {
        return  50.0;
    }
    
}

@end
